package com.runjian.rundo.iot.agent.iec104.manager;

import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

import com.runjian.rundo.iot.agent.business.manager.BaseProtocolManagerImpl;
import com.runjian.rundo.iot.agent.common.manager.ProtocolManager;
import com.runjian.rundo.iot.agent.iec104.config.Iec104Properties;
import com.runjian.rundo.iot.agent.iec104.module.Iec104Protocol;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * 设备管理
 *
 * @author CaoQingHua
 */
@Component
@RequiredArgsConstructor
@Slf4j
public class Iec104ProtocolManager extends BaseProtocolManagerImpl<Iec104Protocol>
    implements ProtocolManager<Iec104Protocol>, ApplicationRunner {

    private final Iec104Properties iec104Properties;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        // 添加进缓存
        this.addLocalProtocolList(iec104Properties.getProtocols());
        log.info("Iec104协议加载完成,协议数据:{}", iec104Properties.getProtocols());
    }
}
